{% extends "base.html" %}
{% import "page.html" as page %}
{% block content %}
    <div id="host_detail" class="content-wrapper list">
        <section class="content-header">
            <h1>
                主机管理
                <small>
                    默认显示10条数据
                </small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url_for('index.index') }}"><i class="fa fa-dashboard"></i> Home</a></li>
                <li><a href="{{ url_for('assets.assets_host') }}"> 主机管理 </a></li>
                <li class="active"> 主机详情</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
                {% for item in hosts %}
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                配置信息
                            </div>
                            <div class="panel-body">
                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered table-hover">
                                        <tbody>
                                        <tr>
                                            <td style="width:50%;">内网IP: {{ item.ip_pool.IP }}</td>
                                            <td>外网IP: {{ item.outerIP }}</td>
                                        </tr>
                                        <tr>
                                            <td>弹性IP: {{ item.elasticIP }}</td>
                                            <td>主机名: {{ item.hostname }}</td>
                                        </tr>
                                        <tr>
                                            <td>CPU: {{ item.cpu }}</td>
                                            <td>内存: {{ item.memory }}</td>
                                        </tr>
                                        <tr>
                                            <td>存储: {{ item.disk }}</td>
                                            <td>系统: {{ item.os }}</td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                使用信息
                            </div>
                            <div class="panel-body">
                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered table-hover">
                                        <tbody>
                                        <tr>
                                            <td style="width:50%;">使用部门: {{ item.user_dpt.name }}</td>
                                            {% if item.device != None %}
                                                <td>设备信息:
                                                    {{ item.device.type }}{{ ' ' }}{{ item.device.sn }}{{ ' ' }}{{ item.device.brand.name }}{{ ' ' }}{{ item.device.model.name }}</td>
                                            {% else %}
                                                <td>设备信息:</td>
                                            {% endif %}
                                        </tr>
                                        <tr>
                                            <td>使用人: {{ item.users.name }}</td>
                                            <td>所属部门: {{ item.owner_dpt.name }}</td>
                                        </tr>
                                        <tr>
                                            <td>运维人员: {{ item.operator.name }}</td>
                                            <td>主机模式: {{ item.host_model }}</td>
                                        </tr>
                                        <tr>
                                            <td>服务: {{ item.service.name }}</td>
                                            <td>位置: {{ item.cabinet.code }}</td>
                                        </tr>
                                        <tr>
                                            <td>创建日期: {{ item.create_date }}</td>
                                            <td>支付方式: {{ item.payment }}</td>
                                        </tr>
                                        <tr>
                                            <td>状态: {{ item.status }}</td>
                                            <td>备注: {{ item.comment }}</td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </section>
    </div>
{% endblock %}
{% block bottom_js %}
    <script src="{{ url_for('static',filename='js/jquery.form.min.js') }}"></script>
    <script>
        window.onload = function () {
            if (({{ menu|tojson }}) in {'host_list': '', 'service_list': '', 'host_detail': ''}) {
                $('#host_manage').addClass('active').addClass('menu-open');
                $('#host_list').addClass('active')
            } else {
                $('#host_manage').removeClass('active').removeClass('menu-open');
            }
        };
        data = {
            errMsg: '',
        };

        new Vue({
            el: '.list',
            data: data,
            methods: {}
        })
    </script>
{% endblock %}